package to;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MaterialTO", propOrder = {
    "materialId",
    "materialName",
    "quantity",
    "unit"
})
@XmlRootElement(name="material")
public class MaterialTO implements Serializable {
	
	@XmlElement(required = true)
	private String materialId;
	@XmlElement(required = true)
	private String materialName;
	@XmlElement(required = true)
	private int quantity;
	@XmlElement(required = true)
	private String unit;

	public MaterialTO(){}

	public MaterialTO(String materialId, String materialName, int quantity,
			String unit) {
		super();
		this.materialId = materialId;
		this.materialName = materialName;
		this.quantity = quantity;
		this.unit = unit;
	}

	public String getMaterialId() {
		return materialId;
	}

	public void setMaterialId(String materialId) {
		this.materialId = materialId;
	}

	public String getMaterialName() {
		return materialName;
	}

	public void setMaterialName(String materialName) {
		this.materialName = materialName;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((materialId == null) ? 0 : materialId.hashCode());
		result = prime * result
				+ ((materialName == null) ? 0 : materialName.hashCode());
		result = prime * result + quantity;
		result = prime * result + ((unit == null) ? 0 : unit.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MaterialTO other = (MaterialTO) obj;
		if (materialId == null) {
			if (other.materialId != null)
				return false;
		} else if (!materialId.equals(other.materialId))
			return false;
		if (materialName == null) {
			if (other.materialName != null)
				return false;
		} else if (!materialName.equals(other.materialName))
			return false;
		if (quantity != other.quantity)
			return false;
		if (unit == null) {
			if (other.unit != null)
				return false;
		} else if (!unit.equals(other.unit))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "MaterialTO [materialId=" + materialId + ", materialName="
				+ materialName + ", quantity=" + quantity + ", unit=" + unit
				+ "]";
	}
	
	
}
